package ZUOYE;
public class test1 {
    public static void main(String[] args){
        //创建类
        Goods goods=new TVs();
        //比较类型,向下转换
        if(goods instanceof  TVs){
            //强制转换
            TVs tVs=(TVs)goods;
            //调用这个方法
            goods.print(tVs);
        }

        Goods goods1=new Foods();
        if(goods1 instanceof  Foods){
            Foods  foods=(Foods) goods1;
            goods1.print(foods);
        }
    }
}
